function formatTime(date) {
  var time={}
  time.year = date.getFullYear()
  time.month = date.getMonth() + 1
  time.day = date.getDate()

  time.hour = date.getHours()
  time.minute = date.getMinutes()
  time.second = date.getSeconds()
  return time
}

function formatNumber(n) {
  n = n.toString()
  return n[1] ? n : '0' + n
}

function getDatas(age, sex){
  let datas = {};
  let maxAge = sex == 1 ? 75 : 78;
  let lestAge = maxAge - age;
  datas.percent = ((1 - age/maxAge)*100).toFixed(1);
  datas.meal = lestAge * 365 *3;
  datas.makeLove = lestAge * 365 / 4 | 0;
  datas.weekend = lestAge * 52;
  datas.holiday = lestAge * 7;
  return datas;
}
module.exports = {
  formatTime: formatTime,
  getDatas: getDatas
}
